/**
 * 
 */

function SelectForm(){ 
    var customer_num=document.getElementById("RechargeNum").value; 
 

       if(customer_num==null||customer_num==""){ 
 

           alert("顾客账号不能为空！请重新输入！"); 
 

       }else{ 
 
          this.RechargeSelectForm.action="RechargeAction_findbyid.action"; 
 

          this.RechargeSelectForm.submit(); 
 

       } 
 

    } 

    function ReMoeny(){ 
 

        var customer_num=document.getElementById("RechargeNum").value; 
 

        var RechargesNum=document.getElementById("RechargesNum"); 
 

       if(customer_num==null||customer_num==""){ 
 

           alert("顾客账号不能为空！请重新输入！请勿途中更改账号！"); 
           return false;
 

       }else{ 
 

          RechargesNum.value=customer_num; 
 

          this.RechargeForm.action="RechargeAction_add.action"; 
 

          this.RechargeForm.submit(); 
 

       } 
 

    } 

    function  returnInfo(){ 
 

         var  returnInfo=document.getElementById("returnInfo").value;//获得控件值 */ 
 
         alert(returnInfo); 
 

         window.history.go(-1); 
 
        } 

    function checkInfo(){ 
    	 var id_list=new Array();    
     	 var num_list=new Array();    
         var name_list=new Array();    
         var i=0;
         var flag=0;  
        $(".am-table input[name=rechargeList]").each(function() { 
            if ($(this).attr("checked")) { 
            	var id =document.getElementsByName("rechargeId");  
            	var num =document.getElementsByName("rechargeNum");  
                var name =document.getElementsByName("rechargeName");
                id_list[flag]=$(id[i]).text();
                num_list[flag]=$(num[i]).text();
                name_list[flag]=$(name[i]).text();
                i++;
                flag++; 
                }else{
                    i++;
              }
        }); 
        if(flag<=0){      //充值列表为空
        alert("充值列表为空 ，请重新勾选！"); 
      }else{     //充值列表不为空 
          var Money=window.prompt("请输入要充值的金额：");
          if(Money==null){
        	  alert("操作已取消！"); 
        	  return false;
          }else{
          while(Money<=0){
        	  if(Money==null){
        		  alert("操作已取消！"); 
                  return false;
        	  }   
        	  var Money=window.prompt("充值金额不合法！请重新输入要充值的金额：");       	  	        	  
           }
         }
        	  var StringList="";     
              for (var i = 0; i < flag; i++) {
                 StringList +="编号："+id_list[i] + "   账号："+num_list[i]+"   姓名："+name_list[i]+"\r\n";
              }         
              var option=confirm("是否确定为以下用户充值"+Money+"元（无法撤销）\r\n"+StringList); 
              if(option==true){ //选择确定 
              var rechargeMoney=document.getElementById("rechargeMoney"); //获取金额控件 
              rechargeMoney.value=Money;   //设置金额 
              this.form.action="RechargeAction_BatchRecharge.action"; //设置处理程序 
              this.form.submit(); //提交表单        
              }else{//取消确认
            	  alert("操作已取消！");
            	  return false;
              }
              
           }
        
        }    
              
   
    function jisuan() { 
 

        var recharge_money = document.getElementById("recharge_money").value; 
 

        var customer_balance = document.getElementById("customer_balance").value; 
 

        document.getElementById("afterreharge").value = parseFloat(recharge_money) 
 

        + parseFloat(customer_balance); 
 

    } 
    function checkAlls(){
    	var flag=false;
    	 $(".hovertable input[name=rechargeList]").each(function() { 
    		    
             if (!$(this).prop("checked")) { 
            	 flag=true;
             } 
         }); 

    	 if(flag==true){
    		 $(".hovertable input[name=rechargeList]").each(function() { 
    			 $(this).prop("checked", true);
    		 });
    	 }else{
    		 $(".hovertable input[name=rechargeList]").each(function() { 
    			 $(this).prop("checked", false);
    		 });
    		 
    	 }
         GetCount(); 

    	
    }
    
    $(document).ready(function() { 
    
      

           // 所有复选(:checkbox)框点击事件 

           $(".hovertable input[id=rechargeList]").click(function() { 

               if (!($(this).prop("checked"))) { 
                           
                            $(this).prop("checked", false); 
                            GetCount();
                           
               } else { 
                          
                            $(this).prop("checked", true); 
                            GetCount();
               } 
           }); 
    
           // 输出 
    
           $(".hovertable input[name=rechargeList]").click(function() { 
            
                   
           }); 

    }); 
     //****************** 
    
       function GetCount() { 
      
           var number = 0; 
    
           $(".hovertable input[name=rechargeList]").each(function() { 
    
               
    
                   for (var i = 0; i < $(this).length; i++) {
                   
                     if ($(this).prop("checked")) { 
                    
                       number += 1; 
                   }else{
                      
                   }
               }
           }); 

           $("#shuliang").text(number); 
         
       } 

